import  json
import sqlite3

if __name__ == '__main__':

    with open("id.json",'r',encoding='utf-8') as f:
        result = json.load(f)
        conn = sqlite3.connect("address.db")
        cursor = conn.cursor()
        cursor.execute("update district_id set district_name='重庆市綦江区' where district_id = 510223")
        # for location in result:
        #
        #     local_id = location["id"]
        #     provinceName = cursor.execute(f"select name from province where id = '{str(local_id)[:2]}'").fetchone()[0]
        #     local_name = (provinceName.strip() + location["countName"]).strip()
        #     print(local_name,local_id)
        #     cursor.execute(f"insert into district_id values ('{local_name}',{local_id})")
        conn.commit()
        conn.close()